package main

import "fmt"

func main() {
	// 复数 "实数+虚数i"
	// complex64 和 complex128
	var complexVariable1 complex64
	complexVariable1 = 3.14 + 12i

	complexVariable2 := complex(3.14, 12)
	fmt.Printf("complexVariable1的类型=%T，值=%v\n", complexVariable1, complexVariable1)
	// complexVariable1的类型=complex64，值=(3.14+12i)
	fmt.Printf("complexVariable2的类型=%T，值=%v\n", complexVariable2, complexVariable2)
	// complexVariable2的类型=complex128，值=(3.14+12i)

	// 打印 complexVariable1 的实数部分和虚数部分
	fmt.Println(real(complexVariable1), imag(complexVariable1))
	// 3.14 12
}
